package cn.zealon.readingcloud.book.feign.fallback;

import cn.zealon.readingcloud.book.feign.client.BookClient;
import cn.zealon.readingcloud.common.pojo.book.Book;
import cn.zealon.readingcloud.common.result.Result;
import cn.zealon.readingcloud.common.result.ResultUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;


// 获取图书失败实现方式
@Component
public class BookClientFallBack implements BookClient { // 直接实现接口，而不是实现FallbackFactory

    private static final Logger LOGGER = LoggerFactory.getLogger(BookClientFallBack.class);

    // 移除create方法，直接实现接口方法
    @Override
    public Result<Book> getBookById(String bookId) {
        LOGGER.error("获取图书[{}]失败", bookId);
        return ResultUtil.success(null);
    }
}

